package com.hwd.gmall.item.controller;

import com.hwd.gmall.common.result.Result;
import com.hwd.gmall.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 商品详情的控制层
 *
 * @author 黄伟东/Victor
 * @date 2022/4/21 23:34
 */
@RestController
@RequestMapping(value = "/api/item")
public class ItemController {

    @Resource
    private ItemService itemService;

    /**
     * 查询sku的详细信息,用于生成sku的详情页面
     *
     * @param skuId skuId
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */
    @GetMapping(value = "/getItemInfo/{skuId}")
    public Map<String, Object> getItemInfo(@PathVariable(value = "skuId") Long skuId) {
        return itemService.getItemInfo(skuId);
    }
}
